import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/theme-chalk/dark/css-vars.css'
import './styles/dark.css'
import utils from './utils/index.js'
import router from './router'
import api from './api/api.js'
import { createPinia } from 'pinia'
import { getCtxRefs } from './utils/getThis.js'
// import Vue from 'vue'



// vueuse切换主题
import { useDark, useToggle } from '@vueuse/core'
const isDark = useDark()
const toggleDark = useToggle(isDark)

const app = createApp(App)

// 切换黑暗模式
app.config.globalProperties.$toggleDark = toggleDark

app.config.globalProperties.$utils = utils

app.config.globalProperties.$api = api

app.config.globalProperties.$getRefs = getCtxRefs

app
  .use(router)
  .use(ElementPlus, { locale: zhCn })
  .use(createPinia())
  .mount('#app')
